//
//  BaseTableViewController.swift
//  晓庄微博
//
//  Created by Maxwell on 10/22/18.
//  Copyright © 2018 Maxwell. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorViewDelegate {
    var userLogin:Bool!
    var access_token:String!
    
    var guestView:VisitorView?
    init(userLogin:Bool){
        self.userLogin = userLogin
        super.init(nibName:nil, bundle:nil)
    }

    init(userLogin:Bool,access_token:String){
        self.userLogin = userLogin
        self.access_token = access_token
        super.init(nibName:nil, bundle:nil)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
        super.viewDidLoad()
        if userLogin {
            super.loadView()
        }else{
            setVisitorView()
        }
        
    }
    func registerButtonWillClicked() {
        print("reg c----")
    }
    
    func loginButtonWillClicked() {
        let oaVC = OAuthViewController()
        let nav = UINavigationController()
        nav.addChild(oaVC)
        present(nav, animated: true, completion: nil)
    }
    private func setVisitorView(){
        guestView = VisitorView()
        guestView?.delegate = self
        view =  guestView//根视图
        view.backgroundColor = UIColor.white
    }

}

